<?php
namespace app\first\model;

use think\Model;
/**
 * Class Push
 * @package app\push\validate
 */
class Push extends Model{
    protected $autoWriteTimestamp = true;

     /**
     * @param array $where
     * @param string $order
     * @param int $limit
     * @param string $filed
     * @return \think\Paginator
     * @throws \think\exception\DbException
     */
    public function getList($where=[],$order='',$limit=10,$filed='*'){
        $list = $this
            ->field($filed)
            ->where($where)
            ->with('user')
            ->order($order)
            ->paginate($limit);
            $page = $list->currentPage();
            $total = $list->total();
            foreach ($list as $k => $v){
                $list[$k]['sort_asc'] = $k + 1 + ($page-1) * $limit;
                $list[$k]['sort_desc'] = $total - ($page-1) * $limit - $k;
            }
         return $list;
    }
    //@todo more
}